package com.xwolf.camel.jms.polling;

import lombok.extern.log4j.Log4j2;
import org.apache.camel.EndpointInject;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.util.Time;
import org.springframework.stereotype.Component;

/**
 * @author ming
 * @Description:
 * @create 2019-01-05 2:11 PM
 **/
@Component("pollingClient")
@Log4j2
public class PollingClient {

    @Produce(uri = "activemq:startConsumer")
    protected ProducerTemplate startConsumer;

    @Produce(uri = "direct:startConsumer")
    protected ProducerTemplate startDirectConsumer;

    @Produce(uri = "activemq:queue:waiting")
    protected ProducerTemplate queue;

    private Integer i= 0;

    public String sendToMqConsonsumer() throws Exception {
        String body = "go -" + i++;
//        log.info("body is :" + body);
//        startConsumer.sendBody(body);
        queue.sendBody(body);
//        startDirectConsumer.sendBody(body);


        return body;

    }
}
